package com.pi.pro.xcmg.am.was.fac.service;



import com.pi.core.exchange.vo.CommonNameRegistryService;
import com.pi.pro.xcmg.am.common.XcmgAmConstants;
import com.pi.pro.xcmg.am.was.edi.infor.dto.reply.FuncReplyListData;
import com.pi.pro.xcmg.am.was.edi.infor.dto.reply.StorageLineResultDto;
import com.pi.pro.xcmg.am.was.edi.sap.dto.reply.DeliveryNoteData;
import com.pi.pro.xcmg.am.was.edi.sap.dto.reply.DeliveryNoteReplyData;
import com.pi.pro.xcmg.am.was.edi.sap.dto.req.DeliveryNoteQueryData;
import com.pi.pro.xcmg.am.was.edi.sap.service.DeliveryNoteServiceProxy;
import com.pi.wms.fac.LocationResolver;
import com.pi.wms.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 *
 */
@Service
public class SapCommonWorkService {

    @Autowired
    private CommonNameRegistryService sapNameRegistryService;

    @Autowired
    private DivisionService divisionService;

    //
    public DeliveryNoteReplyData loadDeliveryNotesData(String divisionCode, DeliveryNoteQueryData queryData){
        DeliveryNoteReplyData replyData=null;

        String m="";
        if (queryData==null){
            queryData=new DeliveryNoteQueryData();
        }
        //
        Long divisionId=this.divisionService.retrieveOn(divisionCode, XcmgAmConstants.DIVISION_WH101_ID);
        //
        DeliveryNoteServiceProxy proxy = null;
        try{
            proxy = this.sapNameRegistryService.takeProxy(XcmgAmConstants.CLIENT_ID_XCMG, divisionId, DeliveryNoteServiceProxy.class);
            if (proxy == null) {
                m = "not found task proxy";
                return replyData;
            }
            replyData=proxy.load(queryData);
        }catch (Exception e){
            e.printStackTrace();
        }
        return replyData;
    }



}
